package com.wardrobe.soa.api.home;

import com.wardrobe.soa.common.ApiResult;
import com.wardrobe.soa.utils.CommonConsant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/11/15.
 */
@RestController
@RequestMapping("/api")
public class HomeInfoController {
    private static final Logger logger = LoggerFactory.getLogger(HomeInfoController.class);

    @Autowired
    private HomeInfoService homeInfoService;
    @RequestMapping("/homeInfo")
    public ApiResult getHomeInfo(double longitude, double latitude){
        try {
            HomeInfoResponse infos = homeInfoService.getHomeInfo(longitude, latitude);
            return new ApiResult(CommonConsant.successCode,CommonConsant.success,CommonConsant.successMsg,infos);
        }catch (Exception e){
            logger.error("getHomeInfo_err",e);
        }
        return new ApiResult(CommonConsant.serverFailedCode,CommonConsant.failed,CommonConsant.serverFailedMsg,"");
    }
}
